package redis

import (
	"12.11rk/appconfig"
	"fmt"
	"github.com/go-redis/redis"
)

var Rdb *redis.Client

func ExampleNewClient() {
	Rdb = redis.NewClient(&redis.Options{
		Addr:     appconfig.AppConfig.RedisConfig.Host2,
		Password: appconfig.AppConfig.RedisConfig.Password2,
	})

	pong, err := Rdb.Ping().Result()
	fmt.Println(pong, err)
	// Output: PONG <nil>
	if err != nil {
		fmt.Println("redis连接失败")
	} else {
		fmt.Println("redis连接成功")
	}
}
